package com.cctcq.action;

import java.util.Hashtable;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.cctcq.dao.impl.ProductDaoImpl;
import com.cctcq.dao.impl.TourGroupDaoImpl;
import com.cctcq.domain.Product;
import com.cctcq.util.jdbc.Page;
import com.cctcq.util.jdbc.Result;
import com.cctcq.util.jdbc.SearchQuery;

public class ProductAction {
	ProductDaoImpl productDaoImpl = new ProductDaoImpl();
	TourGroupDaoImpl tourGroupDaoImpl = new TourGroupDaoImpl();
	private SearchQuery sq;
	private Hashtable<String, Object> hashtable;
	private Product product;
	//log4j日志实例
	static Logger logger = Logger.getLogger (ProductAction.class) ;
	public SearchQuery getSq() {
		return sq;
	}

	public void setSq(SearchQuery sq) {
		this.sq = sq;
	}

	public Hashtable<String, Object> getHashtable() {
		return hashtable;
	}

	public void setHashtable(Hashtable<String, Object> hashtable) {
		this.hashtable = hashtable;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	//根据地区分页查询所有品读产品
	public String findAllDiscoverByArea() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(2);
		Page page2 = new Page(5);
		Page page3 = new Page(5);
		Page page4 = new Page(5);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			//获取查询条件
			sq.setContinent(request.getParameter("searchCondition"));
			request.getSession().setAttribute("searchCondition", request.getParameter("searchCondition"));
			Result result = this.productDaoImpl.getProductsPinByArea(page, sq);
			//获取结果总条数
			request.setAttribute("totalCount", result.getPage().getTotalCount());
			Result result2 = this.productDaoImpl.getProductsIn(page2, sq);
			Result result3 = this.productDaoImpl.getProductsOut(page3, sq);
			Result result4 = this.productDaoImpl.getProductsTogether(page4, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("productListX1", result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("productListIn", result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("productListOut", result3.getContent());
			hashtable.put("pages3", result3.getPage());
			hashtable.put("productTogetherList", result4.getContent());
			hashtable.put("pages4", result4.getPage());
			Integer[] p = new Integer[3];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllDiscoverByArea";
	}
	
	//根据地区分页查询所有闲读产品
	public String findAllXianByArea() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(5);
		Page page2 = new Page(5);
		Page page3 = new Page(5);
		Page page4 = new Page(5);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			//获取查询条件
			sq.setContinent(request.getParameter("searchCondition"));
			request.getSession().setAttribute("searchCondition", request.getParameter("searchCondition"));
			Result result = this.productDaoImpl.getProductsXianByArea(page, sq);
			//获取结果总条数
			request.setAttribute("totalCount", result.getPage().getTotalCount());
			Result result2 = this.productDaoImpl.getProductsIn(page2, sq);
			Result result3 = this.productDaoImpl.getProductsOut(page3, sq);
			Result result4 = this.productDaoImpl.getProductsTogether(page4, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("productListX2",result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("productListIn",result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("productListOut",result3.getContent());
			hashtable.put("pages3", result3.getPage());
			hashtable.put("productTogetherList", result4.getContent());
			hashtable.put("pages4", result4.getPage());
			Integer[] p = new Integer[result.getPage().getEveryPage()];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllXianByArea";
	}

	
	//根据地区分页查询所有精读产品
	public String findAllJingByArea() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(5);
		Page page2 = new Page(5);
		Page page3 = new Page(5);
		Page page4 = new Page(5);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			//获取查询条件
			sq.setContinent(request.getParameter("searchCondition"));
			request.getSession().setAttribute("searchCondition", request.getParameter("searchCondition"));
			Result result = this.productDaoImpl.getProductsJingByArea(page, sq);
			//获取结果总条数
			request.setAttribute("totalCount", result.getPage().getTotalCount());
			Result result2=this.productDaoImpl.getProductsIn(page2, sq);
			Result result3=this.productDaoImpl.getProductsOut(page3, sq);
			Result result4 = this.productDaoImpl.getProductsTogether(page4, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("productListX3",result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("productListIn",result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("productListOut",result3.getContent());
			hashtable.put("pages3", result3.getPage());
			hashtable.put("productTogetherList", result4.getContent());
			hashtable.put("pages4", result4.getPage());
			Integer[] p = new Integer[result.getPage().getEveryPage()];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJingByArea";
	}
	
	//根据地区分页查询所有鉴读产品
	public String findAllJianByArea() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(5);
		Page page2 = new Page(5);
		Page page3 = new Page(5);
		Page page4 = new Page(5);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			//获取查询条件
			sq.setContinent(request.getParameter("searchCondition"));
			request.getSession().setAttribute("searchCondition", request.getParameter("searchCondition"));
			Result result = this.productDaoImpl.getProductsJianByArea(page, sq);
			//获取结果总条数
			request.setAttribute("totalCount", result.getPage().getTotalCount());
			Result result2=this.productDaoImpl.getProductsIn(page2, sq);
			Result result3=this.productDaoImpl.getProductsOut(page3, sq);
			Result result4 = this.productDaoImpl.getProductsTogether(page4, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("productListX3",result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("productListIn",result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("productListOut",result3.getContent());
			hashtable.put("pages3", result3.getPage());
			hashtable.put("productTogetherList", result4.getContent());
			hashtable.put("pages4", result4.getPage());
			Integer[] p = new Integer[result.getPage().getEveryPage()];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJianByArea";
	}
	
	//根据地区分页查询所有体惠产品
	public String findAllTihui() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(1);
		Page page2 = new Page(5);
		Page page3 = new Page(5);
		Page page4 = new Page(5);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			//获取查询条件
			sq.setContinent(request.getParameter("searchCondition"));
			request.getSession().setAttribute("searchCondition", request.getParameter("searchCondition"));
			Result result = this.productDaoImpl.getProductsTihuiByArea(page, sq);
			//获取结果总条数
			request.setAttribute("totalCount", result.getPage().getTotalCount());
			Result result2 = this.productDaoImpl.getProductsIn(page2, sq);
			Result result3 = this.productDaoImpl.getProductsOut(page3, sq);
			Result result4 = this.productDaoImpl.getProductsTogether(page4, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("productListT1", result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("productListIn", result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("productListOut", result3.getContent());
			hashtable.put("pages3", result3.getPage());
			hashtable.put("productTogetherList", result4.getContent());
			hashtable.put("pages4", result4.getPage());
			Integer[] p = new Integer[3];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllTihui";
	}
	
	//当季非当季产品
	public String findAllInOut() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(5);
		Page page2 = new Page(5);
		Page page3 = new Page(5);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsIn(page, query);
			Result result2 = this.productDaoImpl.getProductsOut(page2, query);
			Result result3 = this.productDaoImpl.getProductsTogether(page3, query);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsInList", result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("getProductsOutList", result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("getProductsTogetherList", result3.getContent());
			hashtable.put("pages2", result3.getPage());
			Integer[] p = new Integer[3];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllInOut";
	}
	
	//通过产品ID查询 品读产品  进入产品页面
//	public String findProductsById() throws Exception {
//		HttpServletRequest request = ServletActionContext.getRequest();
//		Page page = new Page(10);
//		Page page2=new Page(3);
//		Page page3=new Page(3);
//		if (request.getParameter("page") != null) {
//			int ye = Integer.parseInt(request.getParameter("page"));
//			page.setCurrentPage(ye);
//		} else {
//			page.setCurrentPage(1);
//		}
//		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
//		if (sq != null) {
//			request.getSession().setAttribute("sq_productList", sq);
//		} else if (query != null) {
//			sq = query;
//		}
//		if (sq == null) {
//			sq = new SearchQuery();
//		}
//		try {
//			Result result = this.productDaoImpl.getProductsById(page, sq);
//			Result result2 = this.productDaoImpl.getProductsIn(page2, sq);
//			Result result3 = this.productDaoImpl.getProductsOut(page3, sq);
//			Result result4=this.productDaoImpl.getProductsTogether(page3, sq);
//			hashtable = new Hashtable<String, Object>();
//			hashtable.put("getProductsByIdList",result.getContent());
//			hashtable.put("pages", result.getPage());
//			hashtable.put("getProductsInList",result2.getContent());
//			hashtable.put("pages2", result2.getPage());
//			hashtable.put("getProductsOutList",result3.getContent());
//			hashtable.put("pages3", result3.getPage());
//			hashtable.put("getProductsTogetherList",result4.getContent());
//			hashtable.put("pages3", result4.getPage());
//			Integer[] p = new Integer[3];
//			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
//				for (int i = 0; i < p.length; i++) {
//					if (i < p.length / 2) {
//						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
//					} else {
//						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
//					}
//				}
//			} else {
//				for (int i = 0; i < p.length; i++) {
//					p[i] = i + 1;
//				}
//			}
//			hashtable.put("p", p);
//		} catch (Exception e) {
//			logger.error(e);
//		}
//		return "findProductsById";
//	}
	public String findProductsByFeature() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(10);
		Page page2=new Page(3);
		Page page3=new Page(3);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			sq.setFeature(request.getParameter("feature"));
			request.getSession().setAttribute("feature",request.getParameter("feature"));
			Result result = this.productDaoImpl.getProductsByFeature(page3, sq);
			Result result2 = this.productDaoImpl.getProductsIn(page2, sq);
			Result result3 = this.productDaoImpl.getProductsOut(page3, sq);
			Result result4=this.productDaoImpl.getProductsTogether(page3, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsByFeatureList",result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("getProductsInList",result2.getContent());
			hashtable.put("pages2", result2.getPage());
			hashtable.put("getProductsOutList",result3.getContent());
			hashtable.put("pages2", result3.getPage());
			hashtable.put("getProductsTogetherList",result4.getContent());
			hashtable.put("pages2", result4.getPage());
			Integer[] p = new Integer[3];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findProductsByFeature";
	}
	//查询 鉴读全部 产品类型(例如:财务交流、党务交流)
	public String findAllJianFeature() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(50);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			//公务交流的
			Result result = this.productDaoImpl.getJianFeature(page, query);
			//会展商务的
			Result result2 = this.productDaoImpl.getJianFeatureTwo(page, query);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getJianFeatureList", result.getContent());
			hashtable.put("pages", result.getPage());
			hashtable.put("getJianFeature2List", result2.getContent());
			hashtable.put("pages2", result2.getPage());
			Integer[] p = new Integer[3];
			if (result.getPage().getCurrentPage() > (result.getPage().getEveryPage() / 2 + 1)) {
				for (int i = 0; i < p.length; i++) {
					if (i < p.length / 2) {
						p[i] = result.getPage().getCurrentPage() - (p.length / 2 - i);
					} else {
						p[i] = result.getPage().getCurrentPage() + (i - p.length / 2);
					}
				}
			} else {
				for (int i = 0; i < p.length; i++) {
					p[i] = i + 1;
				}
			}
			hashtable.put("p", p);
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJianFeature";
	}
	
	
	
	//根据产品ID查询相关体惠团信息
	public String findAllGroupTihuiInfo() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(20);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.tourGroupDaoImpl.getTihuiTourGroups(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("tourGroupList", result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllGroupInfo";
	}
	//根据景区查询次数分页查询所有产品
	public String findAllDiscover() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(6);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsByPopular(page, query);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsByPopularList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllDiscover";
	}
	//游记页面最新线路
	public String findAllXianAndNew() throws Exception{

		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(6);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsXianAndNew(page, query);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsXianAndNewList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllXianAndNew";
	}
	//带图片的闲读类线路展示
	public String findAllXian() throws Exception{
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(3);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsXian(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsXianList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllXian";
	}
	//精读主题分类
	public String findAllJingFeature() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(20);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsJingFeature(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsJingFeatureList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJingFeature";
	}
	//精度主题目的地
	public String findAllJingAreaName() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(20);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsJingAreaName(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsJingAreaNameList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJingAreaName";
	}
	//精度,图片展示
	public String findAllJingPic() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(20);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsJingPic(page, query);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsJingPicList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJingPic";
	}
	//精度,主题线路
	public String findAllJing() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(3);
		if (request.getParameter("page") != null) { 
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		if (sq != null && sq.getPage() != null && !sq.getPage().trim().equals("")) {
			page.setCurrentPage(Integer.parseInt(sq.getPage()));
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsJing(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsJingList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJing";
	}
	//鉴读最新线路
	public String findAllJianNew() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(2);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsJianNew(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsJianNewList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJianNew";
	}
	//查询鉴读 TOP4
	public String findAllJianTop() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(20);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsJianTop(page, sq);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsJianTopList",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findAllJianTop";
	}
	
	/**
	 * 
	*    
	* 项目名称：slowlookj5     
	* 类描述：   
	* 创建人：cctcq_helin   
	* 创建时间：2012-8-28 下午02:29:10   
	* 修改人：cctcq_helin   
	* 修改时间：2012-8-28 下午02:29:10   
	* 修改备注：   细游中心最新推荐展示
	* @version    
	*
	 */
	public String findMycenterNewProduct() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Page page = new Page(4);
		if (request.getParameter("page") != null) {
			int ye = Integer.parseInt(request.getParameter("page"));
			page.setCurrentPage(ye);
		} else {
			page.setCurrentPage(1);
		}
		SearchQuery query = (SearchQuery) request.getSession().getAttribute("sq_productList");
		if (sq != null) {
			request.getSession().setAttribute("sq_productList", sq);
		} else if (query != null) {
			sq = query;
		}
		if (sq == null) {
			sq = new SearchQuery();
		}
		try {
			Result result = this.productDaoImpl.getProductsByMycenterNewProduct(page, query);
			hashtable = new Hashtable<String, Object>();
			hashtable.put("getProductsByMycenterNewProduct",result.getContent());
			hashtable.put("pages", result.getPage());
		} catch (Exception e) {
			logger.error(e);
		}
		return "findMycenterNewProduct";
	}
	
}
